using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FEL.COM;
using System.Text;
using System.Collections.Generic;
using System.Web.Services;
using System.Reflection;

public partial class COM_COM_ARTICULO_REEMPLAZO : PaginaBaseKCG
{
    protected void Page_Load(object sender, EventArgs e)
    {       
        base.Page_Load(sender, e);
    }

    protected override CheckBox CbInsertarMemoria
    {
        get { return null; }
    }

    protected override Type TipoObjeto
    {
        get { return typeof(global::Com_Articulo_Reemplazo); }
    }

    protected override GridView Gv
    {
        get { return gvcom_articulo_reemplazo; }
    }

    protected override FormView Fv
    {
        get { return fvcom_articulo_reemplazo; }
    }

    protected override ObjectDataSource OdsGv
    {
        get { return odsgvcom_articulo_reemplazo; }
    }

    protected override ObjectDataSource OdsDv
    {
        get { return odsfvcom_articulo_reemplazo; }
    }

    protected override Button BResponderZoom
    {
        get { return Seleccionar; }
    }

    protected override Button BRegreso
    {
        get { return Atras; }
    }


    protected override Koala.KoalaWebControls.KFiltro KftFiltro
    {
        get { return kftFiltro; }
    }
    protected override string Contenedor
    {
        get { return "COM_ARTICULO_REEMPLAZO"; }
    }

    protected void nav_Siguiente(object sender, EventArgs e)
    {
        Gv_SelectedIndexChanged(sender, e);
    }

    protected override void DefinirParametrosFijosDeInsercion(System.Collections.Generic.List<DictionaryEntry> param)
    {
        if (Request.QueryString.Count > 0)
        {
            param.Add(new DictionaryEntry("Com_Articulo_Id", Request.QueryString["Com_Articulo_Id"]));
            param.Add(new DictionaryEntry("Com_Articulo_Codigo", Request.QueryString["Com_Articulo_Codigo"]));
            param.Add(new DictionaryEntry("Com_Articulo_Nombre", Request.QueryString["Com_Articulo_Nombre"]));

        }
        base.DefinirParametrosFijosDeInsercion(param);
    }

    [WebMethod]
    static public string[] GetReemplazo(string prefixText, int count)
    {
        if (count == 0) count = 10;

        Scope s = (Scope)HttpContext.Current.Session["Scope"];

        FEL.COM.BO_Com_Articulo ComArticulo = new BO_Com_Articulo();
        List<Com_Articulo> litComArticulo = ComArticulo.GetByLikeNombreArticulos("Nombre", s, prefixText + "%");

        List<string> opciones = new List<string>();
        for (int i = 0; i < litComArticulo.Count && i < count; i++)
        {
            string value = litComArticulo[i].Id + "||" +
                           litComArticulo[i].Codigo;

            opciones.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(litComArticulo[i].Nombre, value));
        }
        return opciones.ToArray();
    }


}